home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / gui / wxextensions.pyo (.txt) < prev   
Python Compiled Bytecode  |  2008-10-13  |  5KB  |  127 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import new
  5.  
  6. def SetMinHeight(self, h):
  7.     self.minHeight = h
  8.     if h != -1 and self.GetSize().height < h:
  9.         self.SetSize((-1, h))
  10.     
  11.  
  12.  
  13. def GetMinHeight(self):
  14.     return self.minHeight
  15.  
  16. import wx.lib.expando as wx
  17. wx.lib.expando.ExpandoTextCtrl.SetMinHeight = SetMinHeight
  18. wx.lib.expando.ExpandoTextCtrl.GetMinHeight = GetMinHeight
  19.  
  20. wx.lib.expando.ExpandoTextCtrl.GetExtraHeight = lambda self: self.extraHeight
  21. del SetMinHeight
  22. del GetMinHeight
  23. import cgui
  24. wx.Rect.Clamp = new.instancemethod(cgui.RectClamp, None, wx.Rect)
  25. wx.Rect.ClampPoint = new.instancemethod(cgui.RectClampPoint, None, wx.Rect)
  26.  
  27. wx.ContextMenuEvent.IsKeyPress = lambda e: e.Position == (-1, -1)
  28.  
  29. wx.Timer.StartRepeating = lambda self, ms: wx.Timer.Start(self, ms, False)
  30.  
  31. wx.Timer.StartOneShot = lambda self, ms: wx.Timer.Start(self, ms, True)
  32.  
  33. def CreateTransparentBitmap(w, h):
  34.     bitmap = wx.EmptyBitmap(w, h)
  35.     bitmap.UseAlpha()
  36.     return bitmap
  37.  
  38. wx.TransparentBitmap = CreateTransparentBitmap
  39.  
  40. try:
  41.     from cgui import SetBold
  42. except ImportError:
  43.     import sys
  44.     print >>sys.stderr, 'WARNING: using slow SetBold'
  45.     
  46.     def SetBold(win, bold = True):
  47.         f = win.Font
  48.         None(f.SetWeight if bold else wx.FONTWEIGHT_NORMAL)
  49.         win.Font = f
  50.  
  51.  
  52. if getattr(wx, 'WXPY', False):
  53.     wx.WindowClass = wx._Window
  54. else:
  55.     wx.WindowClass = wx.Window
  56. wx.WindowClass.SetBold = new.instancemethod(SetBold, None, wx.WindowClass)
  57.  
  58. def call_later_repr(self):
  59.     funcinfo = funcinfo
  60.     import util
  61.     fi = funcinfo(self.callable)
  62.     if self.running:
  63.         return '<CallLater (running) %s>' % fi
  64.     else:
  65.         return '<CallLater %s>' % fi
  66.  
  67. wx.CallLater.__repr__ = call_later_repr
  68. if not getattr(wx, 'WXPY', False):
  69.     
  70.     wx.Dialog.__enter__ = lambda self: self
  71.     
  72.     wx.Dialog.__exit__ = lambda self, type, value, traceback: self.Destroy()
  73.     
  74.     def IsDestroyed(win):
  75.         return not bool(win)
  76.  
  77.     from cStringIO import StringIO
  78.     
  79.     def ImageFromString(s):
  80.         return wx.ImageFromStream(StringIO(s))
  81.  
  82.     wx.ImageFromString = ImageFromString
  83.     wx.AcceleratorTableFromSequence = wx.AcceleratorTable
  84.     wx.IsDestroyed = IsDestroyed
  85.     del IsDestroyed
  86.  
  87. if not hasattr(wx.RendererNative, 'DrawFocusRect'):
  88.     
  89.     wx.RendererNative.DrawFocusRect = lambda *a, **k: pass
  90.  
  91. import webview
  92. if not hasattr(webview.WebView, 'ResetTextSize'):
  93.     
  94.     webview.WebView.ResetTextSize = lambda *a, **k: pass
  95.  
  96. if 'wxGTK' in wx.PlatformInfo:
  97.     orig_bmpeq = wx.Bitmap.__eq__
  98.     
  99.     def bmpeq(self, other):
  100.         if isinstance(other, wx.Bitmap):
  101.             return orig_bmpeq(self, other)
  102.         
  103.         return False
  104.  
  105.     wx.Bitmap.__eq__ = bmpeq
  106.  
  107.  
  108. def RaiseExisting(cls):
  109.     for tlw in wx.GetTopLevelWindows():
  110.         if type(tlw) is cls:
  111.             tlw.Raise()
  112.             return tlw
  113.             continue
  114.     
  115.  
  116. wx.TopLevelWindow.RaiseExisting = classmethod(RaiseExisting)
  117.  
  118. try:
  119.     from cgui import LeftDown
  120. except ImportError:
  121.     
  122.     def LeftDown():
  123.         return wx.GetMouseState().LeftDown()
  124.  
  125.  
  126. wx.LeftDown = LeftDown
  127.